<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>上传gay鹏截图</title>
    <style>
        body{
            display: flex;
            height: 500px;
        }
        .formdiv{
            margin: auto;
        }
        form{
            width: 250px;
        }
        .inputdiv{
            margin-bottom: 15px;
            height: 30px;

        }
        span{
            display: inline-block;
            font-size: 20px;
            color: green;
            width: 30%;
            float: left;
            box-sizing: border-box;
        }

        input[type='text']{
            display: inline-block;
            width: 70%;
            outline: 0;
            border: 1px solid seagreen;
            height: 30px;
            line-height: 30px;
            padding:0 3px;
            background-color: azure;
            box-sizing: border-box;
            float: left;

        }
        input[type='submit']{
            border: 1px solid green;
            color: white;
            font-weight: bold;
            font-size: 16px;
            width: 230px;
            height: 40px;
            line-height: 40px;
            width: 100%;
            background-color: green;

        }
        #file_input{
            display: none;
        }
        #file_btn{
            border: 1px solid green;
            color: white;
            font-weight: bold;
            font-size: 16px;
            width: 150px;
            height: 30px;
            line-height: 30px;
            box-sizing: border-box;
            width: 70%;
            float: left;
            background-color: green;
        }

    </style>
</head>
<body>
    <div class="formdiv">
        <form action="" method="post" enctype="multipart/form-data">
            <div class="inputdiv">
                <span>姓名：</span>
                <input type="text" name="username">
            </div>

            <div class="inputdiv">
                <span>文件：</span>
                <button id="file_btn">点击上传</button>
                <input id="file_input" type="file" name="file">
            </div>


            <input type="submit" value="提&nbsp;&nbsp;&nbsp;交">

        </form>

    </div>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>
    <script>
        $(function () {
            $("#file_btn").click(function (event) {
                event.preventDefault();
                $("#file_input").click();
            });
        });


    </script>
</body>
</html>